<template>
    <view class="box">
        <jushi-signature base64 :settings="settings" @change="signatureChange"></jushi-signature>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                settings:{ //签名设置
                    width: '100%',//签名区域的宽
                    height: '100%',//签名区域的高
                    lineWidth:3,//签名时线宽
                    textColor:'#007AFF' //签名文字颜色
                },
                imgUrl: ''
            }
        },
        methods: {
            signatureChange(e) {
				if(e){
					this.imgUrl = e
					// 在当前页面跳转到上一页，并携带参数
					let pages = getCurrentPages(); // 当前页页⾯实例
					let nowPage = pages[pages.length -1]; //当前页⾯实例
					let prevPage = pages[pages.length -2]; // 上一页面实例
					prevPage.$vm.signatureImg(this.imgUrl) // 调用上一页 定义的方法
					uni.navigateBack({
					  delta:1 // 可以不写，默认值为 1
					})
				}
            }
        }
    }
</script>

<style>
	.box{
		height: 100vh;
	}
	.container{
		display: flex;
	}
	:deep(.center){
		height: 100vh;
		width: 85%;
	}
    .preview{
        margin: 10rpx;
        border: 1rpx solid #aaaaaa;
        border-radius: 10rpx;
    }
	:deep(.btn-view){
		display: flex;
		flex-direction: column;
		width: 15%;
	}
	:deep(.save){
			transform: rotate(270deg);
		}
	:deep(.clear){
			transform: rotate(270deg);
	}
	:deep(uni-canvas){
		height: 100vh !important;
	}
	:deep(.sign-area) {
	    position: absolute;
	    top: 33%;
	    left: -12%;
	    width: 400px;
	    color: #eeeeee;
	    font-size: 4.0625rem;
	    transform: rotate(275deg)
	}
    .text {
        margin: 20rpx;
        color: #aaaaaa;
    }
	:deep(.sign-area){
		transform: rotate(270deg);
	}
</style>